package main

import (
	"fmt"
	"time"
)

const (
	Cluster           = 0
	Debug             = 0
	NormalStart       = 0 //是否正常启动
	KafkaIpAddress    = "10.10.9.20:9092"
	Cluster0IpAddress = "10.10.9.47"
	Cluster1IpAddress = "10.10.9.48"
	Cluster2IpAddress = "10.10.9.49"
	Cluster3IpAddress = "10.10.9.5"
	ClusterPort       = 8080
	KafkaPort         = ":9091"
	//KafkaIpAddress = "192.168.1.125:9092"
)

func main() {
	fmt.Println("启动服务")
	go InitsServer()
	go tls_server(0)
	go tls_server(1)
	go tls_server(2)
	go tls_server(3)
	fmt.Println("等待同步")
	time.Sleep(5 * time.Second)
	fmt.Println(Cluster, "开始")
	go GetBlock()
	DownloadMessage()

}

func ClusterIp(cluster int) (IP string) {
	switch cluster {
	case 0:
		IP = Cluster0IpAddress
	case 1:
		IP = Cluster1IpAddress
	case 2:
		IP = Cluster2IpAddress
	case 3:
		IP = Cluster3IpAddress
	default:
		fmt.Println("error when read obj: Cluster Number Error")
		return
	}
	return IP
}
